<?php
namespace Tbf\Component\Crypto\Password\Verify;
use Tbf\Component\Crypto\Password\VerifyInterface;
/**
* crypt 密码方案
*/
class CryptVerify implements VerifyInterface
{
    public function verify($plain,$hashed)
    {
        return crypt($plain,$hashed)===$hashed;
    }
    public static $support_id = array(
        '1',
        '2a','2x','2y',
        '5','6'
        );
    /**
    * 不支持DES方案(太旧)
    */
    public function support($hashed)
    {
        $data = explode('$',$hashed);
        if (count($data)<=1) {
            return false;
        }
        if (!in_array($data[1],self::$support_id)) {
            return false;
        }

        return true;
    }
}
